% train_data = [
%     0.4003; 0.3988; 0.3998; 0.3997;
%     0.2554; 0.3139; 0.2627; 0.3802;
%     0.5632; 0.7687; 0.0524; 0.7586
% ];
% 
% train_labels = [1; 1; 1; 1; 2; 2; 2; 2; 3; 3; 3; 3];

test_data = [
     0.4003; 0.3988; 0.3998; 0.3997; 0.4010; 0.3995; 0.3991;
    0.2554; 0.3139; 0.2627; 0.3802;0.3287; 0.3160; 0.2924;
    0.5632; 0.7687; 0.0524; 0.7586;0.4243; 0.5005; 0.6769
];

likelihoods = zeros(size(test_data, 1), 3); % Store likelihoods for each class
prior_probs = ones(1, 3) / 3; % Equal prior probabilities for all classes

% Calculate likelihoods for each class
for i = 1:size(test_data, 1)
    x = test_data(i);
    
    likelihoods(i, 1) = normpdf(x, 0.4, 0.01);
    likelihoods(i, 2) = normpdf(x, 0.32, 0.05);
    likelihoods(i, 3) = normpdf(x, 0.55, 0.2);
end

[~, predictions] = max(likelihoods .* prior_probs, [], 2); % MAP classification

disp(predictions);

% % Count the number of correctly classified measurements
% correct_count = sum(predictions == [1; 1; 1; 2; 2; 2; 3;3;3]);
% disp(correct_count);